package com.example.demo.controller;

import com.example.demo.common.Result;
import com.example.demo.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("api/v1/order")
public class OrderController {
    @Autowired
    private OrderService orderService;

    @GetMapping
    public Result getOrders(@RequestHeader("Authorization")String token){
        return orderService.getOrders(token);
    }

    @DeleteMapping("/{id}")
    public Result cancelOrder(@PathVariable("id") Integer id){
        return orderService.cancelOrder(id);
    }
}
